package cn.jeefast.modules.platform.controller;


import cn.jeefast.common.entity.MbResearchData;
import cn.jeefast.common.utils.R;
import cn.jeefast.modules.platform.service.MbResearchData1Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import cn.jeefast.common.base.BaseController;



/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author theodo
 * @since 2020-01-06
 */
@RestController
@RequestMapping("/mbResearchData")
@CrossOrigin
public class MbResearchData1Controller extends BaseController {
    @Autowired
	private MbResearchData1Service researchData1Service;

    /**
     * 数据分析列表（分页）
     * @param page
     * @param limit
     * @return
     */
    @RequestMapping("/dataDetail")
    public R dataDetail(Long id,Integer page,Integer limit){
        page = (page-1)*limit;
        return researchData1Service.dataDetail(id,page,limit);
    }

    /**
     * 数据分析详情页(基础信息)
     * @return
     */
    @RequestMapping("/info")
    public R dataInfo(Long id){
        return researchData1Service.dataInfo(id);
    }

    /**
     * 审核不通过接口
     * @param id
     * @param reason
     * @return
     */
    @RequestMapping("/refuse")
    public R refuse(Long id ,String reason){
        return researchData1Service.refuse(id,reason);
    }

    /**
     * 审核通过
     * @param id
     * @return
     */
    @RequestMapping("/accept")
    public R accept(Long id){
        MbResearchData mbResearchData = new MbResearchData();
        mbResearchData.setDataId(id);
        mbResearchData.setState(3);
        researchData1Service.updateById(mbResearchData);
        return R.ok();
    }
}
